package com.mym.demo;

import java.util.Objects;

/**
 * @author miao
 * @version 1.0
 * @date 2025/4/10 17:05
 * @description
 */
public class Test4 {
    public static void main(String[] args) {
        Triange triange1 = new Triange(3,4,5);
        Triange triange2 = new Triange(8, 9, 13);
        System.out.println(triange1.getArea());
        System.out.println(triange2.getArea());
        System.out.println(triange1.getPiremeter());
        System.out.println(triange2.getPiremeter());
    }
}
class Triange{
    private double a;
    private double b;
    private double c;

    public Triange() {
    }

    public Triange(double a, double b, double c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

    @Override
    public String toString() {
        return "Triange{" +
                "a=" + a +
                ", b=" + b +
                ", c=" + c +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Triange triange = (Triange) o;
        return Double.compare(triange.a, a) == 0 && Double.compare(triange.b, b) == 0 && Double.compare(triange.c, c) == 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(a, b, c);
    }
    public double getArea(){
        double p = (a + b + c)/2;
        return Math.sqrt(p * (p-a) * (p-b) * (p-c));
    }
    public double getPiremeter(){
        return a+b+c;
    }
}
